/* 
 * File:   macInterface.c
 * Author: Evan
 *
 * Created on March 27, 2010, 12:57 AM
 */

#include <stdio.h>
#include <stdlib.h>
#include "Interface.h"
#include <ApplicationServices.framework/Headers/ApplicationServices.h>

/*
 * 
 */
CGEventRef callBack(CGEventTapCallBack*);

JNIEXPORT void JNICALL Java_systemInterface_Interface_keyDown(JNIEnv *env, jobject obj, jint key) {
    CGEventRef event = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)key, true);
    CGEventPost(kCGAnnotatedSessionEventTap, event);
    CFRelease(event);
}
JNIEXPORT void JNICALL Java_systemInterface_Interface_keyUp(JNIEnv *env, jobject obj, jint key) {
    CGEventRef event = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)key, false);
    CGEventPost(kCGAnnotatedSessionEventTap, event);
    CFRelease(event);
}
